using System.Collections.Generic;

namespace GenericsFramework
{
	public static class IEnumerableExtensions
	{
		public static IEnumerable<TOut> Map<T, TOut>(this IEnumerable<T> enumerable, IMapping<T, TOut> mapping)
			where T : class
			where TOut : class
		{
			if (enumerable != null)
				foreach (var element in enumerable)
					yield return mapping.Parse(element);
		}
	}
}